package com.miyake.client.datamanage;

import com.google.gwt.user.client.ui.Panel;

public class SummaryPageFactory implements PageFactory {
	NodeUpdateHandler handler = null;
	public SummaryPageFactory(NodeUpdateHandler handler) {
		this.handler = handler;
	}
	
	@Override
	public void createChart(NodeProperty node, Panel panel) {
		new ShowFixedPlot(node, panel, 250, 130, handler) {
			@Override
			protected void onTextUpdate(String nodeKey) {
				if (handler != null) {
					handler.onNodeUpdate(nodeKey);
				}
			}
			
		};
	}

	@Override
	public void createTable(NodeProperty node, Panel panel) {
		new ShowTableSample(node, panel);	
	}

	@Override
	public void createText(NodeProperty node, Panel panel) {
		new ShowEditableText(node, panel) {
			@Override
			protected void onTextUpdate(String nodeKey) {
				if (handler != null) {
					handler.onNodeUpdate(nodeKey);
				}
			}
		};
	}

	@Override
	public void createImage(NodeProperty node, Panel panel) {
		new ShowImage(node, panel, "200px", "100px");
	}

	@Override
	public void createPaper(NodeProperty node, Panel panel) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void createData(NodeProperty node, Panel panel) {
		new ShowData(node, panel);
	}

}
